package com.bidr.authorization.controller.admin;

import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.bidr.authorization.dao.entity.AcRole;
import com.bidr.authorization.dao.entity.AcUser;
import com.bidr.authorization.dao.entity.AcUserRole;
import com.bidr.authorization.service.admin.AdminRoleUserBindService;
import com.bidr.authorization.vo.admin.RoleRes;
import com.bidr.authorization.vo.user.UserRes;
import com.bidr.kernel.controller.BaseBindController;
import com.bidr.kernel.mybatis.repository.BaseBindRepo;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Title: AdminRoleUserBindController
 * Description: Copyright: Copyright (c) 2023
 *
 * @author Sharp
 * @since 2023/05/09 16:59
 */
@Api(tags = "系统管理 - 角色-人员 - 绑定管理")
@RestController("AdminRoleUserBindController")
@RequestMapping(value = "/web/admin/role/user")
@RequiredArgsConstructor
public class AdminRoleUserBindController extends BaseBindController<AcRole, AcUserRole, AcUser, RoleRes, UserRes> {

    @Override
    protected SFunction<AcUserRole, ?> bindEntityId() {
        return AcUserRole::getRoleId;
    }

    @Override
    protected SFunction<AcUserRole, ?> bindAttachId() {
        return AcUserRole::getUserId;
    }

    @Override
    protected SFunction<AcUser, ?> attachId() {
        return AcUser::getUserId;
    }

    @Override
    protected SFunction<AcRole, ?> entityId() {
        return AcRole::getRoleId;
    }
}
